<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>测试使用jquery</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  <script  type="text/javascript" src="js/jquery-1.11.3.js"></script>
  <script type="text/javascript">
  	$(function(){
  	//给input元素添加时间
  	//获取目标元素id  #class
  		$("#uname").focus(function(){
  	 	 	var span=$("#unameVa");
  	  		span.html("用户名需在6~12字符！");
  		}
  		);
  		//
  		$("#uname").blur(function(){
  			//获取元素内容
  			var uname=$("#uname").val();
  			var len=uname.length;
  			var span=$("#unameVa");
  			if(len <=6||len >=12){
  			   span.html("非法！");
  			
  			}else{
  			   span.html("ok!");
  			}
  		}
  		);
  		
  	}
  	);    
  
  
  </script>
  </head>
  
  <body>
  <div class="box-div" >
  		<form action="" method="get">
  		<span id="unameVa" style="font-size:25px"></span><br/>
  		姓名:<input type="text" name="uname" id="uname" /><br/><br/>
  		密码:<input type="password" name="upass" id="upass" onfocus="checkPass();"/><br/><br/>
  		<input type="submit" value="提交" class="btn">
  		</form>
 
    
    
     </div>
  </body>
</html>
